import React, {ReactNode, createContext,useContext} from 'react';
import {Platform} from 'react-native';
import {PushyProvider, Pushy, usePushy} from 'react-native-update';
import _updateConfig from '../../update.json';

const pushyClient = new Pushy({
  appKey: _updateConfig[Platform.OS as 'android'].appKey,
  debug: true,
});

type UploadRootProps = {
  children: ReactNode;
};

type Value = {};

const UploadContext = createContext<Value | undefined>(undefined);

export default function UploadRoot({children}: UploadRootProps) {
  const info = usePushy();
  console.log(info);
  return (
    <UploadContext.Provider value={{}}>
      <PushyProvider client={pushyClient}>{children}</PushyProvider>
    </UploadContext.Provider>
  );
}



export const useUploadContext = function() {
    const ctx = useContext(UploadContext);
    return ctx;
};
